/************************************************************************/
/*Copyright (c) James Zhao 2007,2008
/*This file is part of AdminOverlay.
/*AdminOverlay is free software: you can redistribute it and/or modify
/*it under the terms of the GNU General Public License as published by
/*the Free Software Foundation, either version 3 of the License, or
/*(at your option) any later version.
/*
/*AdminOverlay is distributed in the hope that it will be useful,
/*but WITHOUT ANY WARRANTY; without even the implied warranty of
/*MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
/*GNU General Public License for more details.
/*
/*You should have received a copy of the GNU General Public License
/*along with Foobar.  If not, see <http://www.gnu.org/licenses/>.                                                                     */
/*************************************************************************/
#include "MainPanel.h"

MainPanel::MainPanel(int x, int y, int width, int height) : UIPanel(x,y,width,height)
{
	isMouseDown = false;
	xDiff = 0;
	yDiff = 0;
}

MainPanel::~MainPanel(void)
{
}

void MainPanel::onKeyPress( int keyCode , bool isCtrlDown)
{
// 	if(keyCode == VK_SPACE)
// 	{
// 		UIManager::currentInstance()->IsActive
// 			(UIManager::currentInstance()->IsActive() ? false : true);		
// 	}
}

void MainPanel::onMouseUp( POINT pt , bool isPrimaryTarget)
{
	isMouseDown  = false;
	xDiff = 0;
	yDiff = 0;

}

void MainPanel::onMouseDown(POINT pt, bool isPrimaryTarget)
{	
	isMouseDown = true;
	xDiff = pt.x;
	yDiff = pt.y;
}

void MainPanel::onMouseMove(POINT pt,  bool pIsMouseDown, bool isPrimaryTarget)
{
	if(isMouseDown)
	{				
		X(X() + (pt.x - xDiff));
		Y(Y() + (pt.y - yDiff));
	}
}
